import {useNavigate,useSearchParams,useParams,useLocation} from 'react-router-dom'
function withRouter(WrapperComponent){
    return function(props){
        const nav=useNavigate()
        const [query]=useSearchParams()
        const params=useParams()
        const {state}=useLocation()
        return <WrapperComponent 
                nav={nav} 
                query={query} 
                params={params} 
                state={state}
                {...props}>
            </WrapperComponent>
    }
}
export default withRouter